package com.hang.ad.controller;

import com.hang.ad.SponsorClient;
import com.hang.ad.annotations.IgnoreResponseAdvice;
import com.hang.ad.vo.AdPlan;
import com.hang.ad.vo.AdPlanRequest;
import com.hang.ad.vo.CommonResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class SearchController {
    @Qualifier("eureka-client-ad-sponsor")
    @Autowired
    private SponsorClient sponsorClient;

    @PostMapping("/getAdPlan")
    @IgnoreResponseAdvice
    public CommonResponse<List<AdPlan>> getAdPlan(@RequestBody AdPlanRequest request){
        return sponsorClient.getAdPlan(request);
    }
}
